<template>
  <div>
    <!-- 通过ref绑定获取h1元素引用 -->
    <h1 ref="titleRef">chpeng</h1>
    <el-button @click="handleBtn">按钮</el-button>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { gsap } from "gsap";
const titleRef = ref(null);
let tl = gsap.timeline();
const handleBtn = () => {
  tl.to(titleRef.value, {
    x: 100,
    duration: 1,
  }).to(titleRef.value, {
    x: 0,
    duration: 1,
  });
};
</script>
